package org.run;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.poker.Poker;
import org.poker.exception.PokerException;

public class PokerMain {


	public static void main(String[] args) {

		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));

		try {
			Poker.newCards();
		} catch (PokerException e1) {
			e1.printStackTrace();
		}

		while(true) {

			try {
				System.out.println(Poker.printHandCardsLabelTxt());
				System.out.println("selecione a carta[1~5] : " );
				String texto = buf.readLine();
				System.out.println(">>: " + texto );

				if(!"ok".equals(texto)) {
					Poker.selectUnselectCard(Integer.valueOf(texto).intValue()-1);
					System.out.println(Poker.printHandCardsLabelTxt());
				}
				if("ok".equals(texto)) {
					Poker.switchSelectedCards();
					System.out.println(Poker.printHandCardsLabelTxt());
					System.out.println(Poker.printResultLabel());
					System.out.println(Poker.printPoints());
					Poker.newDeck();
					Poker.newCards();
				}

			} catch (IOException e) {
				e.printStackTrace();
			} catch (PokerException e) {
				e.printStackTrace();
			}
		}
	}
}
